#ifndef CHAT_SERVER_H
#define CHAT_SERVER_H

#include <QWidget>
#include <QTcpServer>
#include <QTcpSocket>
#include <QVector>
class chat_server : public QWidget
{
    Q_OBJECT

public:
    explicit chat_server(QWidget *parent = nullptr);
    ~chat_server();

private:
    QTcpServer* server;//服务器管理

    QTcpSocket* socket;
    QVector<QTcpSocket*> sockets;

private:
    void createGroup();
private:
    void sendFileList(QTcpSocket *socket);

    void sendFile(QTcpSocket *socket, const QString &filename);
private slots:
    void newConnection_slot();
    void disconnected_slot();
    void readyRead_slot();
};
#endif // CHAT_SERVER_H
